package com.example.project.controller;

import com.example.project.entity.Cpc;
import com.example.project.service.ICpcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/*
编写者：王住泽
 */

@RestController
@Api
public class CpcController {
    @Autowired
    private ICpcService CpcServic;
    @RequestMapping("/Cpc")
    public String Cpc(){
        return "党员信息管理系统";
    }
    @ApiOperation(value = "添加党员信息")
    @RequestMapping("addCpc")
    public int insertCpc(Cpc cpc){
        return CpcServic.insertCpc(cpc);
    }
    @ApiOperation(value = "删除党员信息")
    @RequestMapping("/deleteCpc")
    public int delectCpc(String CpcId){
        Cpc cpc=new Cpc();
        cpc.setCpcId(CpcId);
        return CpcServic.deleteCpc(cpc);
    }
    @ApiOperation(value = "修改党员信息",
            notes = "成功返回1")
    @RequestMapping("/updateCpc")
    public int updateCpc(Cpc cpc){
        return CpcServic.updataCpc(cpc);
    }
    @ApiOperation(value = "查询所有党员信息",
            notes = "成功返回1")
    @RequestMapping("/getAllCpc")
    public List<Cpc> getAllCpc(Cpc cpc){
        return CpcServic.getAllCpc(cpc);
    }
    @ApiOperation(value = "查询党员信息",
            notes = "成功返回1")
    @RequestMapping("/getCpc")
    public Cpc getId(String CpcId){
        Cpc cpc=new Cpc();
        cpc.setCpcId(CpcId);
        return CpcServic.getCpc(cpc);
    }

}
